{
LANG : PASCAL
PROB : fence4
}

program FENCE4;
const
  fi = 'fence4.in';
  fo = 'fence4.out';
  max = 201;
  eps = 1E-8;
type
  point = record
            x, y : extended;
          end;
  line1 = record
            p1, p2 : point;
          end;
  line2 = record
            a, b, c : extended;
          end;
var
  p : array[0..max] of point;
  l1 : array[1..max] of line1;
  l2 : array[1..max] of line2;
  stack : array[1..max, 1..2] of integer;
  view : point;
  n, top : integer;

procedure inp;
var
  i : integer;
begin
  read(n);
  with view do read(x, y);
  for i := 1 to n do
    with p[i] do read(x, y);
  p[0] := p[n];
  p[n+1] := p[1];
end;

procedure getline(l1 : line1; var l2 : line2);
begin
  with l1 do
    with l2 do
    begin
      a := p2.y - p1.y;
      b := p1.x - p2.x;
      c := -(a*p1.x + b*p1.y);
    end;
end;

procedure init;
var
  i : integer;
begin
  for i := 1 to n do
  begin
    l1[i].p1 := p[i];
    l1[i].p2 := p[i+1];
    getline(l1[i], l2[i]);
  end;
end;

function CCW(p1, p2, p3 : point) : integer;
var
  a1, b1, a2, b2, t : extended;
begin
  a1 := p2.x - p1.x;
  b1 := p2.y - p1.y;
  a2 := p3.x - p2.x;
  b2 := p3.y - p2.y;
  t := a1*b2 - a2*b1;
  if abs(t) < eps then CCW := 0
  else
    if t > 0 then CCW := 1
    else CCW := -1;
end;

procedure swap(var x, y : extended);
var
  temp : extended;
begin
  temp := x;
  x := y;
  y := temp;
end;

function between(p0, p1, p2 : point) : boolean;
begin
  if p1.x > p2.x then swap(p1.x, p2.x);
  if p1.y > p2.y then swap(p1.y, p2.y);
  between := (p1.x <= p0.x) and (p0.x <= p2.x) and
             (p1.y <= p0.y) and (p0.y <= p2.y);
end;

function intersect(l1, l2 : line1) : boolean;
var
  v1, v2, v3, v4 : integer;
begin
  v1 := CCW(l1.p1, l2.p1, l2.p2);
  v2 := CCW(l1.p2, l2.p1, l2.p2);
  if (v1 = 0) and (v2 = 0) then
    intersect := between(l1.p1, l2.p1, l2.p2) or between(l1.p2, l2.p1, l2.p2)
  else
  begin
    v3 := CCW(l2.p1, l1.p1, l1.p2);
    v4 := CCW(l2.p2, l1.p1, l1.p2);
    intersect := (v1*v2 <= 0) and (v3*v4 <= 0);
  end;
end;

function cutitself : boolean;
var
  i, j : integer;
begin
  cutitself := true;
  for i := 3 to n-1 do
    if intersect(l1[1], l1[i]) then exit;
  for i := 2 to n-2 do
    for j := i+2 to n do
      if intersect(l1[i], l1[j]) then exit;
  cutitself := false;
end;

function clockwise : boolean;
var
  i : integer;
  S : extended;
begin
  S := 0;
  for i := 1 to n do S := S + (p[i+1].x-p[i].x) * (p[i+1].y+p[i].y);
  if S > 0 then clockwise := true
  else clockwise := false;
end;

function isfence : boolean;
begin
  isfence := (not cutitself) and (not clockwise);
end;

procedure push(k : integer);
begin
  inc(top);
  if k = n then
  begin
    stack[top, 1] := 1;
    stack[top, 2] := n;
  end
  else
  begin
    stack[top, 1] := k;
    stack[top, 2] := k+1;
  end;
end;

procedure chbi(k : integer; var left, right : line1);
begin
  with left do
  begin
    p1  := view;
    p2  := p[k];
  end;
  with right do
  begin
    p1 := view;
    p2 := p[k+1];
  end;
end;

procedure tang(var k : integer);
begin
  if k = n then k := 1
  else inc(k);
end;

function inside(p : point; A, B, C : point) : boolean;
var
  v1, v2, v3 : integer;
begin
  v1 := CCW(p, A, B);
  v2 := CCW(p, B, C);
  v3 := CCW(p, C, A);
  inside := (v1 = v2) and (v2 = v3);
end;

procedure intersection(A, I : point; l2 : line2; var M : point);
var
  l : line1;
  l1 : line2;
  d, dx, dy : extended;
begin
  l.p1 := A;
  l.p2 := I;
  getline(l, l1);
  d  := l1.a*l2.b - l1.b*l2.a;
  dx := l1.b*l2.c - l1.c*l2.b;
  dy := l1.c*l2.a - l1.a*l2.c;
  with M do
  begin
    x := dx/d;
    y := dy/d;
  end;
end;

function visible(k : integer) : boolean;
var
  i, j : integer;
  cutl, cutr, ok : boolean;
  left, right : line1;
  O : point;
begin
  visible := false;
  if CCW(view, p[k], p[k+1]) = 0 then exit;
  chbi(k, left, right);
  i := k;
  repeat
    tang(i);
    cutl := intersect(l1[i], left);
    cutr := intersect(l1[i], right);
    if cutl and cutr then exit;
    if (not cutl) and (not cutr) then continue;
    ok := false;
    for j := i to i+1 do
      if inside(p[j], view, left.p2, right.p2) then
      begin
        ok := true;
        break;
      end;
    if ok then
    begin
      intersection(view, p[j], l2[k], O);
      if cutl then left.p2 := O
      else right.p2 := O;
    end;
  until (p[i+1].x = p[k].x) and (p[i+1].y = p[k].y);
  visible := true;
end;

procedure process;
var
  i : integer;
begin
  if not isfence then
  begin
    writeln('NOFENCE');
    exit;
  end;
  for i := 1 to n do
    if visible(i) then push(i);
end;

procedure out;
var
  i, j, temp : integer;
begin
  if (top >= 2) and (stack[top-1, 2] = stack[top, 2]) then
  begin
    temp := stack[top-1, 1];
    stack[top-1, 1] := stack[top, 1];
    stack[top, 1] := temp;
  end;
  writeln(top);
  for i := 1 to top do
  begin
    for j := 1 to 2 do
    begin
      write(p[stack[i, j]].x:0:0, ' ', p[stack[i, j]].y:0:0);
      if j = 1 then write(' ');
    end;
    writeln;
  end;
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);
  inp;
  init;
  process;
  out;
  close(output);
  close(input);
end.